<?php

use app\components\DateTimePickerAsset;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

DateTimePickerAsset::register($this);

?>

<div class="activity-form">
    <?php $form = ActiveForm::begin([
        'id' => 'Activity',
        'options' => ['class' => 'form-horizontal'],
        'fieldConfig' => [
            'template' => "{label}\n<div class=\"col-lg-9\">{input}\n{hint}\n{error}</div>",
            'labelOptions' => ['class' => 'col-lg-3 control-label']
        ]
    ]); ?>
    
    <?= $form->field($model, 'expert_id', ['enableAjaxValidation' => TRUE])->textInput($model->id ? ['readonly' => 'readonly'] : []); ?>
    <?= $form->field($model, 'uname')->textInput(['maxlength' => true]); ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]); ?>

    <?= $form->field($model, 'phone')->textInput(['maxlength' => true]); ?>

    <?= $form->field($model, 'start_time')->textInput(['class' => 'form-control date-time', 'readonly' => 'readonly']); ?>

    <?= $form->field($model, 'end_time')->textInput(['class' => 'form-control date-time', 'readonly' => 'readonly']); ?>
    <?= $form->field($model, 'off_time')->textInput(['class' => 'form-control date-time', 'readonly' => 'readonly']); ?>

    <?= $form->field($model, 'limit')->textInput()->hint('人'); ?>

    <?= $form->field($model, 'type')->textInput(['maxlength' => true]); ?>

    <?= $form->field($model, 'address')->textarea(['maxlength' => true, 'rows' => 3]); ?>

    <?= $form->field($model, 'money')->textInput(); ?>

    <?= $form->field($model, 'money_type')->textInput(['maxlength' => true]); ?>

    <div class="form-group hidden">
        <?= Html::submitButton('保存', ['class' => 'btn btn-full']) ?>
    </div>

    <?php ActiveForm::end(); ?>
</div>

<?php $this->registerJs("$('.date-time').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        language: 'zh-CN',
        autoclose: true,
        todayHighlight: true,
        todayBtn: true
    });"); ?>

<?php //$this->registerJs("$('#Activity').yiiActiveForm('updateAttribute', 'activity-expert_id', [\"I have an error...\"]);"); ?>

